package interface3;

public class ClassDataInter1 implements ClassDataInter
{
    private Student students[];
    public ClassDataInter1(Student students[])
    {
        this.students = students;
    }
    @Override
    public void printAllstudentinfors()
    {

        int i = 0;
        System.out.println("全班信息如下：");
        for(i = 0;i<students.length;i++)
        {
            Student s = students[i];
            System.out.println("姓名：" + s.getName() +"性别："+ s.getSex() +"分数" + s.getScore() );
        }
    }

    @Override
    public void printAverageScore()
    {
        double sum = 0;
        int i = 0;
        for(i = 0;i<students.length;i++)
        {
            Student s = students[i];
            sum = sum + s.getScore();
        }
        System.out.println("平均分是："+ sum/students.length);

    }
}
